Action hook 'created_{$taxonomy}'

in WP Core File wp-includes/taxonomy.php at line 2741

View Source

created_{$taxonomy}

Action Hook
Description
Fires after a new term in a specific taxonomy is created, and after the term cache has been cleaned. The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. Possible hook names include: - `created_category` - `created_post_tag`

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 2741

Hook Parameters

Type Name Description
int $term_id Term ID.
int $tt_id Term taxonomy ID.
array $args Arguments passed to wp_insert_term().

Usage Examples

Basic Usage
<?php
// Hook into created_{$taxonomy}
add_action('created_{$taxonomy}', 'my_custom_function', 10, 3);

function my_custom_function($term_id, $tt_id, $args) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:2741 - How this hook is used in WordPress core
<?php
2736  	 *
2737  	 * @param int   $term_id Term ID.
2738  	 * @param int   $tt_id   Term taxonomy ID.
2739  	 * @param array $args    Arguments passed to wp_insert_term().
2740  	 */
2741  	do_action( "created_{$taxonomy}", $term_id, $tt_id, $args );
2742  
2743  	/**
2744  	 * Fires after a term has been saved, and the term cache has been cleared.
2745  	 *
2746  	 * The {@see 'saved_$taxonomy'} hook is also available for targeting a specific

PHP Documentation

<?php
/**
	 * Fires after a new term in a specific taxonomy is created, and after the term
	 * cache has been cleaned.
	 *
	 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
	 *
	 * Possible hook names include:
	 *
	 *  - `created_category`
	 *  - `created_post_tag`
	 *
	 * @since 2.3.0
	 * @since 6.1.0 The `$args` parameter was added.
	 *
	 * @param int   $term_id Term ID.
	 * @param int   $tt_id   Term taxonomy ID.
	 * @param array $args    Arguments passed to wp_insert_term().
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.